using UnityEngine;

// This script should be placed on a GameObject in your PlayerCubeScene.
public class Bootstrap : MonoBehaviour
{
    void Start()
    {
        // Find the player object in the scene.
        GameObject playerCube = GameObject.Find("PlayerCube");

        if (playerCube != null)
        {
            // Add the PlayerController component by its string name.
            // This works because the HotUpdate.dll containing the PlayerController script
            // has already been loaded by our Loader script in the previous scene.
            playerCube.AddComponent(System.Type.GetType("PlayerController, HotUpdate"));
            
            Debug.Log("PlayerController component added to PlayerCube at runtime.");
        }
        else
        {
            Debug.LogError("Could not find a GameObject named 'PlayerCube' in the scene.");
        }

        // After adding the component, this bootstrap script is no longer needed.
        Destroy(this);
    }
} 